package com.example.administrator.kotiln.adapter;

import android.app.Activity;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.administrator.kotiln.R;
import com.example.administrator.kotiln.utils.AppManager;

import java.util.ArrayList;
import java.util.List;


/**
 * Created by Administrator on 2017/10/16.
 */

public class MyPagerAdapters extends PagerAdapter {
    private List<View> mList;
    private Context context;

    public MyPagerAdapters(Context context, List<View> list) {
       // mList = new ArrayList<View>();
        this.context = context;
        this.mList = list;



    }


    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return Integer.MAX_VALUE;
    }

    @Override
    public boolean isViewFromObject(View arg0, Object arg1) {
        // TODO Auto-generated method stub
        return arg0 == arg1;
    }

    //销毁上一页
    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        // TODO Auto-generated method stub

        position = position % mList.size();

        container.removeView(mList.get(position));
    }

    // <pre name="code"class="java">        //添加下一页

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        // TODO Auto-generated method stub

        position = position % mList.size();

        container.addView(mList.get(position));
        return mList.get(position);
    }



}
